<?php
/* vim: set expandtab tabstop=4 shiftwidth=4: */
// +-----------------------------------------------------------------
// | 业务逻辑库(1.0)
// +-----------------------------------------------------------------
// | Copyright: (c) 2016 Genxin, Inc. All Rights Reserved.
// +-----------------------------------------------------------------
// | PHP version: 5.4
// +-----------------------------------------------------------------
// | Encoding: UTF-8
// +-----------------------------------------------------------------
// | Authors: Geng Xin <gengxin55200@126.com>
// +-----------------------------------------------------------------
//
// $Id: $

header("Content-Type:text/html; charset=UTF-8");

/**
 * 显示状态(会员，管理员)
 *
 * @param $status
 * @return mixed
 */
function showRoleStatus($status = '')
{
    $role_info = array(
        '0' => '正常',
        '1' => '冻结'
    );
    if ($status !== '') {
        return $role_info[$status];
    }
    return $role_info;
}

/**
 * 用户删除
 *
 * @param $del
 * @return mixed
 */
function showRoleDel($del = '')
{
    $del_info = array(
        '0' => '正常',
        '1' => '删除'
    );
    if ($del !== '') {
        return $del_info[$del];
    }
    return $del_info;
}

/**
 * 操作状态
 *
 * @param $param
 * @return mixed
 */
function showCoinType($param = '')
{
    $list = array(
        '1' => '消费',
        '2' => '充值',
        '3' => '兑换'
    );
    if ($list !== '') {
        return $list[$param];
    }

    return $list;
}

/**
 * 比赛状态
 *
 * @param $param
 * @return mixed
 */
function showMatchStatus($param = '')
{
//    $list = array(
//        '0' => '未开始',
//        '1' => '报名截止',
//        '2' => '比赛完成'
//    );
    $list = array(
        '0' => '未发布',
        '1' => '已发布'
    );
    if ($list !== '') {
        return $list[$param];
    }

    return $list;
}

/**
 * 参赛状态
 *
 * @param $param
 * @return mixed
 */
function showCompetitionStatus($param = '')
{
    $list = array(
        '0' => '抢号成功',
        '1' => '参赛',
        '2' => '弃权'
    );
    if ($list !== '') {
        return $list[$param];
    }

    return $list;
}

/**
 * 是/否显示
 * 适用于： 是否可以参赛，是否为种子选手
 *
 * @param $param
 * @return mixed
 */
function showYesOrNo($param = '')
{
    $list = array(
        '0' => '否',
        '1' => '是'
    );
    if ($list !== '') {
        return $list[$param];
    }

    return $list;
}

/**
 * 订单状态
 *
 * @param string $param
 * @return array
 */
function showOrderStatus($param = '')
{
    $list = array(
        '0' => '未购买',
        '1' => '生成订单',
        '2' => '支付成功',
        '3' => '申请提货',
        '4' => '申请提货',
        '5' => '提货成功'
    );
    if ($list !== '') {
        return $list[$param];
    }

    return $list;
}

/**
 * 积分状态
 *
 * @param string $param
 * @return array
 */
function showScoreType($param = '')
{
    $list = array(
        '1' => '登录赠送',
        '2' => '消费',
        '3' => '奖励',
    );
    if ($list !== '') {
        return $list[$param];
    }

    return $list;
}

/**
 * 积分状态
 *
 * @param string $param
 * @return array
 */
function showMemberType($param = '')
{
    $list = array(
        '0' => '普通',
        '1' => '种子选手',
    );
    if ($list !== '') {
        return $list[$param];
    }
    return $list;
}